package br.com.mmm.javacenter.framework.filters.wrapper;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;

public class BufferOutputStream extends ServletOutputStream{
	private ByteArrayOutputStream baos = new ByteArrayOutputStream();
	
	public void write(int b) throws IOException {
		baos.write(b);
	}

	public ByteArrayOutputStream getBaos() {
		return baos;
	}

	public void setBaos(ByteArrayOutputStream baos) {
		this.baos = baos;
	}
	@Override
	public void write(byte[] b) throws IOException {
		baos.write(b);
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		baos.write(b, off, len);
	}
	@Override
	public void print(String s) throws IOException {
		baos.write(s.getBytes());
	}
	@Override
	public void flush() throws IOException {
		baos.flush();
	}
	
}
